<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Shop extends Model
{
    protected $guarded = ['id'];
    protected $appends = ['status_txt','status_style']; 

    private $shopStatus = [
                        '0' =>['style'=>'warning','txt'=>'待审核'],
                        '1' =>['style'=>'success','txt'=>'正常'],
                        '-1'=>['style'=>'danger', 'txt'=>'停用'], 
                        
                    ];
   

    public function getStatusTxtAttribute()
    {
       
        return array_get($this->shopStatus,$this->status.'.txt');
    }

    public function getStatusStyleAttribute()
    {
        return array_get($this->shopStatus,$this->status.'.style');
    }

   

    public function order()
    {
    	return $this->hasMany(Order::class);
    }

    public function product()
    {
    	return $this->hasMany(Product::class);
    }

   
}
